import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { join, resolve } from 'path'
import createImportPlugin from 'vite-plugin-imp'

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      '@': resolve(__dirname, 'source/view')
    }
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true
      }
    }
  },
  plugins: [
    vue(),
    createImportPlugin({
      libList: [
        {
          libName: 'ant-design-vue',
          style (name) {
					  if (/popconfirm/.test(name)) {
              // support multiple style file path to import
              return [
						  'ant-design-vue/es/button/style/index.css',
						  'ant-design-vue/es/popover/style/index.css'
              ]
					  }
					  return `ant-design-vue/es/${name}/style/index.css`
          }
				  }
      ]
    })
  ],
  server:{
     port:3003
  },
  base: './',
  build: {
    outDir: join(__dirname, './dist/view')
  }
})
